# Rendering

## render

Renders a component into a DOM element. Creates a reactive root and handles mounting and unmounting.

**Type:**

```ts
render(code: Getter<JSX.Element>, el: Element | Document): () => void
```

**Parameters:**

- `code`: A function that returns the JSX element to render
- `el`: The DOM element or document to render into

**Returns:** A dispose function that cleans up the rendered component

**Example:**

```jsx
function App() {
  const [count, setCount] = useSignal(0)
  return (
    <div>
      <p>Count: {count()}</p>
      <button onClick={() => setCount((prev) => prev + 1)}>Increment</button>
    </div>
  )
}

const dispose = render(() => <App />, document.getElementById('app'))

// Later, to unmount and clean up
// dispose()
```
